package com.fy.springmvc.enetity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fy.springmvc.utils.MySerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(value= JsonInclude.Include.NON_EMPTY)
public class User {
    private Integer id;
    private String name;
    @JsonInclude(value = JsonInclude.Include.NON_EMPTY)
    private Integer age;
    private String address;
    // 将Double salary的值 四舍五入
    @JsonSerialize(using = MySerializer.class )
    private Double salary;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    private Date ctime;


}
